home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 117 / MacAddict 117.dmg / Software / Internet & Communication / Snak 5.1 (shareware).dmg / Snak.app / Contents / Resources / Scripts / trivia.txt < prev    next >
Text File  |  2005-03-14  |  36KB  |  1,202 lines

  1. # IRCII Trivia Script v2.0
  2. # Copyright (c) 2001-2005 Bernard Yen (Seeker on IRC)
  3. # V 1.1.0   Initial release. Created by Bernard Yen.        
  4. # V 2.0     Adapted and updated for Snak 5 by Kent Sorensen. 
  5. #            All support questions for version 2.0 must be sent to kents@snak.com
  6. #            Improved saving.
  7. #            Removed setting of homedir and rmcmd
  8. #            Added mkdir for TriviaScript directory in your home folder
  9. #            Moved trivia.sav file to TriviaScript directory
  10. #            Changed all calls to say to trivsay which uses the -t flag to direct the message to the channel that was active when the script was loaded
  11. #            Removed the need to authenticate, and took out the passwords
  12. #            Questions are answered in the channel
  13. #            Took out storage of wrong answers. This can't be maintained when questions are answered in the channel.
  14. #            The penalties are also gone..
  15. #            Renamed auth_help to update_stats
  16. #            Only one correct answer per question
  17. #            !start no longer required the admin password
  18. #            Removed the duel system as it won't fit the current model
  19. #            Remind user to change admin password on first launch
  20. # --------------------------------------------------------------------------
  21. # This software is provided 'as-is', without any expressed or implied
  22. # warrenty. In no event will the author be held liable for any damages
  23. # arising from the use of this software.
  24. #
  25. # Permissing is granted to anyone to use this software for non-commercial
  26. # purposes and to alter and redistribute it freely, subject to the
  27. # following restrictions:
  28. #
  29. # 1. The origin of this software must not be misrepresented; you must not
  30. # claim that you wrote the original software. If you use this software in
  31. # a product, an acknowledgement in the product documentation is required.
  32. #
  33. # 2. Altered source versions must be plainly marked as such, and must not
  34. # be misrepresented as being the original software
  35. #
  36. # 3. This notice may not be removed or altered from any source distribution.
  37. #
  38. # --------------------------------------------------------------------------
  39.  
  40. # --- Program Constant Declarations ---
  41.  
  42. # Limit on how long each question is posed for in seconds
  43.  
  44. @trivia.LIMIT.1 = 30
  45. @trivia.LIMIT.2 = 25
  46. @trivia.LIMIT.3 = 20
  47. @trivia.LIMIT.4 = 20
  48. @trivia.LIMIT.5 = 20
  49.  
  50. # Number of seconds to pause between questions
  51.  
  52. @trivia.BREAK = 10
  53.  
  54. # Number of seconds to pause between final score and start of wagering. Note that
  55. # the actual time between display of score and wagering start is WAGERWAIT - BREAK
  56. # since both timers are started at the same time.
  57.  
  58. @trivia.WAGERWAIT = 30
  59.  
  60. # Number of seconds to pause between start of wagering and end of wagering.
  61.  
  62. @trivia.WAGERTIME = 30
  63.  
  64. # Number of rounds available in one game, excluding wagering round.
  65.  
  66. @trivia.MAXROUND = 4
  67.  
  68. # Number of questions for each round. Last round must have exactly 1 question.
  69.  
  70. @trivia.QU.1 = 5
  71. @trivia.QU.2 = 5
  72. @trivia.QU.3 = 5
  73. @trivia.QU.4 = 5
  74. @trivia.QU.5 = 1
  75.  
  76. # Maximum number of daily double questions per round.
  77.  
  78. @trivia.SUDDENDEATH = 3
  79.  
  80. # Probability of daily double questions appearing (1/PROBDEATH).
  81.  
  82. @trivia.PROBDEATH = 8
  83.  
  84. # Proportion of regular round's point to give to player if they get daily double questions right.
  85. # The final award is (round's point)*trivia.AWARDDEATH.
  86.  
  87. @trivia.AWARDDEATH = 2
  88.  
  89. # Amount of points awarded for each round. Last round is 0 points since it is the wagering
  90. # round, and people cannot obtain additional points for getting it right.
  91.  
  92. @trivia.P.1 = 1
  93. @trivia.P.2 = 2
  94. @trivia.P.3 = 4
  95. @trivia.P.4 = 8
  96. @trivia.P.5 = 0
  97.  
  98. # Administrative password -- required for all admin commands.
  99.  
  100. @trivia.ADMINPASS = [default]
  101.  
  102. # Valid commands that can be sent to the bot.
  103.  
  104. @trivia.VALIDCMD = [!start !stop !reset !add !sub !wipe !save !title !title_kill]
  105.  
  106. # Valid admin commands that can be sent to the bot.
  107.  
  108. @trivia.VALIDADMINCMD = [!stop !reset !add !sub !wipe !save]
  109.  
  110. # Rank above which player can create their own title.
  111.  
  112. @trivia.MAXRANK = 1000
  113.  
  114. # People who have helped on this project and deserves special mention.
  115.  
  116. @trivia.THANKYOU = [chibi_k, dunno001, Hisoka, InuTrunks, IPChan, Klepto, Knotz, lego, Mike-hime, melz, NFD, Teppei, XObadboy, xxloloxx]
  117.  
  118. # Version of the trivia script.
  119.  
  120. @trivia.VERSION = [2.0]
  121.  
  122. # --- file saving stuff ---
  123.  
  124. # Snak adaptation 1.1.1 make trivia store its file in a subdirectory to home
  125. EVAL /comment $mkdir(${HOME}/TriviaScript)
  126.  
  127. @ trivia.SAVEFILE = [trivia.sav]
  128.  
  129. # --- Channel Name is the active channel when the script was loaded ---
  130. # can be changed later with /triviachannel <channel>
  131. @trivia.channel = [$C]
  132.  
  133. # --- Global Variables ---
  134.  
  135. # People who have answered the current question correctly
  136.  
  137. @trivia.curques = []
  138.  
  139. # Flag indicating whether a game is running (0:NO, 1:YES)
  140.  
  141. @trivia.current = 0
  142.  
  143. # Current trivia round number
  144.  
  145. @trivia.round = 0
  146.  
  147. # Questions remaining in current round
  148.  
  149. @trivia.remaining = 0
  150.  
  151. # Question number of current round being asked
  152.  
  153. @trivia.quesnum = 0
  154.  
  155. # Flag indicating whether there is a question being shown right now
  156.  
  157. @trivia.active = 0
  158.  
  159. # A list of all used questions since the robot has been started
  160.  
  161. @trivia.usedques = []
  162.  
  163. # Flag indicating whether bonus points are given
  164.  
  165. @trivia.bonus = 0
  166.  
  167. # Flag indicating whether wagering is allowed
  168.  
  169. @trivia.wager = 0
  170.  
  171. # Flag to fix problems with the compare function during wagering
  172.  
  173. @trivia.wager_special = 0
  174.  
  175. # Count of the number of sudden death questions which has appeared
  176.  
  177. @trivia.amtdeath = 0
  178.  
  179. # Flag indicating whether current question is a sudden death question
  180.  
  181. @trivia.deathflag = 0
  182.  
  183. # Flag indicating whether the question list is loaded
  184.  
  185. @trivia.qloaded = 0
  186.  
  187. # A question timer to display how fast the players responds to the question
  188.  
  189. @trivia.timer = 0
  190.  
  191. # --- Start of program code. Do not modify anything below this line. ---
  192. alias triviachannel {
  193.     @trivia.channel = [$0]
  194. }
  195.  
  196. alias trivsay {
  197.     say -t $trivia.channel $-
  198. }
  199.  
  200. alias trivia {
  201.     # Load the auxilary question file into memory if not loaded yet.
  202.  
  203.     if (!trivia.qloaded) {
  204.         $loadq()
  205.     }
  206.     
  207.     # Load the saved variables from file.
  208.     
  209.     if (!trivia.stat_loaded) {
  210.         if (fileexists(${HOME}/TriviaScript/$trivia.SAVEFILE))
  211.         {
  212.             /load -p ${HOME}/TriviaScript/$trivia.SAVEFILE
  213.         }
  214.     }
  215.         
  216.     # Check whether a game is currently running. Give an error if there is.
  217.  
  218.     if (trivia.current == 0) {
  219.         @trivia.current = 1
  220.         
  221.         # Print out the trivia header (copyright, thank you note, trivia record holder)
  222.         
  223.         trivsay Trivia v$trivia.VERSION Copyright 2002-2005 by 5Seeker
  224.         trivsay Support questions must be sent to Kent Sorensen - kents@snak.com
  225.         trivsay Type !help for a list of available commands
  226.         trivsay     
  227.         
  228.         if (trivia.ADMINPASS == [default])
  229.         {
  230.             echo Your administrator password has not been changed from 'default'
  231.             echo Please type /adminpass <new password>
  232.         }
  233.  
  234.         
  235.         if (!trivia.bestscore || trivia.bestscore == 0) {
  236.             trivsay Highest Trivia Record:5 None @4 0 point
  237.         }
  238.         {
  239.             if (trivia.bestscore == 1) {
  240.                 trivsay Highest Trivia Record:5 $trivia.bestname @4 1 point
  241.             }
  242.             {
  243.                 trivsay Highest Trivia Record:5 $trivia.bestname @4 $trivia.bestscore points
  244.             }
  245.         }
  246.         
  247.         trivsay     
  248.         
  249.         score
  250.         
  251.         # Initialize the randomizer, clear global variables, and show the first question.
  252.         
  253.         @trivia.correct = 0
  254.         @trivia.round = 0
  255.         @trivia.remaining = 0
  256.         @trivia.quesnum = 0
  257.         @trivia.remaining = 0
  258.         @trivia.active = 0
  259.         @trivia.wager = 0
  260.         @trivia.wager_special = 0
  261.         @trivia.amtdeath = 0
  262.         @trivia.deathflag = 0
  263.         
  264.         @trivia.randomvar = trivia.randomvar + 1
  265.         @trivia.seed = [$time()] + trivia.randomvar
  266.         
  267.         $srand($trivia.seed)
  268.         $show_question()
  269.     }
  270.     {
  271.         trivsay [ERROR] Please wait until the current game ends before starting another
  272.     }
  273. }
  274.  
  275. #     Load or reload the question into memory so it can be used by this script.
  276.  
  277. alias loadq {
  278.     ^load trivia_question
  279. }
  280.  
  281. #     Show a question based on the round number. Higher rounds are more difficult. $0 controls whether the
  282. #     wagering round is on (0:NO, 1:YES).
  283.  
  284. alias show_question {
  285.     # Clear global variables.
  286.     
  287.     @trivia.curques = []
  288.  
  289.     # If no more questions available in this round, move to next round and reset question number.
  290.  
  291.     if (!trivia.remaining) {
  292.         @trivia.quesnum = 1
  293.         @trivia.round= trivia.round + 1
  294.         @trivia.remaining = trivia[QU][$trivia.round]
  295.     }
  296.     {
  297.         @trivia.quesnum = trivia.quesnum + 1
  298.     }
  299.     
  300.     # Set expiration timer for current question. If we are in wagering round, queue up $calc_wager to be called.
  301.     
  302.     if ([$0] == 1) {
  303.         ^timer -refnum 1 $trivia[LIMIT][$trivia.round] /calc_wager
  304.     }
  305.     {
  306.         ^timer -refnum 1 $trivia[LIMIT][$trivia.round] /question_timed_out
  307.     }
  308.  
  309.     # Find the maximum number of question available on the current difficulty level and choose
  310.     # one of them. If the question has been posed already, choose another one.
  311.  
  312.     @trivia.catques = trivia[C][$trivia.round]
  313.     @trivia.pick = rand($trivia.catques) + 1
  314.  
  315.     while ([$match($trivia.round*$trivia.pick $trivia.usedques)]) {
  316.         @trivia.pick = rand($trivia.catques) + 1
  317.     }
  318.  
  319.     # Add question to used question list (format round*quesnum)
  320.  
  321.     ^assign trivia.usedques $trivia.usedques $trivia.round*$trivia.pick
  322.     ^assign trivia.temp $trivia[A][$trivia.round][$trivia.pick]
  323.     ^assign trivia.temp $#trivia.temp
  324.  
  325.     # Potentially make this question a daily double question, but the wagering round cannot
  326.     # be turned into a daily double, so additional checks are done. If the question turns out
  327.     # to be a daily double, we increment $trivia.amtdeath by 1 to keep track.
  328.  
  329.     @trivia.deathflag = 0
  330.  
  331.     if ((trivia.amtdeath < trivia.SUDDENDEATH) && (trivia.round <= trivia.MAXROUND)) {
  332.         if (rand($trivia.PROBDEATH) == 0) {
  333.             @trivia.deathflag = 1
  334.             @trivia.amtdeath = trivia.amtdeath + 1
  335.         }
  336.     }
  337.     @trivia.temptitle = [=== Round $trivia.round Question $trivia.quesnum Time Limit: $trivia[LIMIT][$trivia.round] seconds]
  338.  
  339.     if (!trivia.deathflag) 
  340.     {
  341.         if (trivia[P][$trivia.round] > 0)
  342.         {
  343.             if (trivia[P][$trivia.round] == 1)
  344.             {
  345.                 @trivia.temptitle = trivia.temptitle##[ >>1 point per question<< ===]
  346.             }
  347.             {
  348.                 @trivia.temptitle = trivia.temptitle##[ >>$trivia[P][$trivia.round] points per question<< ===]
  349.             }
  350.         }
  351.         {
  352.             # in the wagering round
  353.             @trivia.temptitle = trivia.temptitle##[ ===]
  354.         }
  355.     } 
  356.     {
  357.         if (trivia[P][$trivia.round] > 0)
  358.         {
  359.             @trivia.tempcalc = trivia.AWARDDEATH * trivia[P][$trivia.round]
  360.             @trivia.temptitle = trivia.temptitle##[ >>DAILY DOUBLE $trivia.tempcalc points per question<< ===]
  361.         }
  362.         {
  363.             @trivia.temptitle = trivia.temptitle##[ >>DAILY DOUBLE<< ===]
  364.         }
  365.     }
  366.     
  367.     trivsay $trivia.temptitle
  368.     ^assign -trivia.temptitle
  369.  
  370.     if ([$0] == 1) {
  371.         trivsay Type 4/msg $N <answer>  to answer wagering question
  372.     }
  373.  
  374.     
  375.     # If the answer is a number (i.e. trivia.Q.R.P.N is defined), don't print out the number of words
  376.     # so people are not confused.
  377.     
  378.     if (trivia[Q][$trivia.round][$trivia.pick][N]) {
  379.         trivsay [4Q] 3$trivia[Q][$trivia.round][$trivia.pick] \<number\>
  380.     }
  381.     {
  382.         if (trivia.temp == 1) {
  383.             trivsay [4Q] 3$trivia[Q][$trivia.round][$trivia.pick] \<$trivia.temp word\>
  384.         }
  385.         {
  386.             trivsay [4Q] 3$trivia[Q][$trivia.round][$trivia.pick] \<$trivia.temp words\>
  387.         }
  388.     }
  389.     
  390.     # Start the timer so we can record down how fast the players answer the question. Also
  391.     # activate the trivia.active flag to indicate that there is an active question.
  392.     
  393.     @trivia.timer = time()
  394.     @trivia.active = 1
  395. }
  396.  
  397.  
  398. #     This function parses messages that the bot may receive. It processes both commands which begin
  399. #     with a "!" and regular answers. If there are no active question, all msgs are treated as regular
  400. #     text which is not processed (except commands, which are still processed).
  401.  
  402. alias handle_public {
  403.  
  404.     if (word(0 $1-) == [!start]) {
  405.         ^timer 1 /trivia
  406.     }
  407.     {
  408.         if (word(0 $1-) == [!help]) {
  409.             #     Help system which private notices a help menu to people who type !help in the channel.
  410.             ^notice $0 Please type 4/msg $N !help <topic> to receive help on specific topics:
  411.             ^notice $0 01. General info: copyright, general, start_game
  412.             ^notice $0 02. Special features: daily_double
  413.             ^notice $0 03. Stat related: title, title_kill
  414.             ^notice $0 04. Admin control: add, reset, save, start, stop, sub, wipe
  415.         }
  416.         {
  417.             if (!trivia.active) {
  418.                 # Normal message, don't do anything.
  419.             }
  420.             {
  421.                 # If it is the wagering round but they don't have points, they are not allowed to answer.
  422.                     
  423.                 if ((trivia.round == (trivia.MAXROUND + 1)) && !trivia[SCORE][$encode($0)]) {
  424.                     ^notice $0 [ERROR] You need at least 1 point to answer in the wagering round.
  425.                 }
  426.                 {
  427.                     # Check the real answer. 
  428.                     $compare($0 $1-)
  429.                 }
  430.             }
  431.             
  432.         }
  433.     }
  434. }
  435.  
  436. #     Handles commands embedded in the incoming private messages. If the command requires special
  437. #     authorization, this function checks the admin password before passing the command on to
  438. #     $parse_admin().
  439.  
  440. alias handle_private {
  441.  
  442.     # Parsing of wagering messages.
  443.     if (trivia.wager && word(0 $1-) == [!wager]) {
  444.         # Check to make sure there is a valid wager, meaning $2 exist and is a positive integer. We also
  445.         # check whether the player has enough points.
  446.         
  447.         @trivia.temp = strip(abcdefghijklmnopqrstuvwxyz. $tolower($2))
  448.         
  449.         if (!trivia.temp || trivia.temp <= 0 || trivia.temp > trivia[SCORE][$encode($0)]) {
  450.             ^notice $0 [ERROR] Command is !wager <amount> where amount more than 0 but less than your score.
  451.         }
  452.         {
  453.             if (trivia.temp == 1) {
  454.                 ^notice $0 You have chosen to wager5 $trivia.temp point.
  455.             }
  456.             {
  457.                 ^notice $0 You have chosen to wager5 $trivia.temp points.
  458.             }
  459.             
  460.             # This is a validated wager, so go ahead and place it (exits function).
  461.             
  462.             $putwager($0 $trivia.temp)
  463.         }
  464.     }
  465.  
  466.     # Determine whether they are messaging a valid command. If so, go to command parsing.
  467.     # Otherwise, go to message parsing.
  468.  
  469.     if (match($word(0 $1-) $trivia.VALIDCMD)) 
  470.     {        
  471.         # !title, !title_kill are used for the personal stat system.
  472.                     
  473.         if (word(0 $1-) == [!title]) {
  474.             @trivia.tempnet = trivia[SCORE][$encode($0)]
  475.             
  476.             if (trivia.tempnet < trivia.MAXRANK) {
  477.                 ^notice $0 [ERROR] Sorry, but your rank is not high enough to use this command.
  478.             }
  479.             {
  480.                 if (!word(1 $1-)) {
  481.                     ^notice $0 [ERROR] Command is !title <new title>.
  482.                 }
  483.                 {
  484.                     ^timer 1 /change_title $0 $2-
  485.                 }
  486.             }
  487.         }
  488.  
  489.         if (word(0 $1-) == [!title_kill]) {
  490.             if (trivia[SELF_TITLE][$encode($0)] != []) {
  491.                 ^assign -trivia[SELF_TITLE][$encode($0)]
  492.                 ^notice $0 Your customized title has been successfully removed.
  493.             }
  494.             {
  495.                 ^notice $0 [ERROR] Sorry, but you do not have a customized title to delete.
  496.             }
  497.         }
  498.         
  499.         if (word(0 $1-) == [!start]) {
  500.             ^timer 1 /trivia
  501.         }
  502.         
  503.  
  504.         # !stop, !reset, !add, !sub, !wipe are admin cmds which require the
  505.         # admin password. Do not put non-admin commands below here because the admin password is
  506.         # checked at this point. Normal commands will fail.
  507.         
  508.         if (!match($word(0 $1-) $trivia.VALIDADMINCMD)) {
  509.             # Don't do anything since this is not an admin command.
  510.         }
  511.         {
  512.             if (word(1 $1-) != trivia.ADMINPASS) {
  513.                 ^notice $0 [ERROR] The admin password you provided is not correct.
  514.             }
  515.             {
  516.                 $parse_admin($0 $1-)
  517.             }
  518.         }
  519.     }
  520.     {
  521.         if (word(0 $1-) == [!help]) {
  522.         
  523.             if (word(1 $1-) == [copyright]) {
  524.                 ^notice $0 The full content of this script as well auxilary support files are copyrights of Bernard Yen. You are allowed to modify and distribute the script on a non-profit basis, but changes must be clearly stated and not misrepresented as the original.
  525.             }
  526.  
  527.             if (word(1 $1-) == [general]) {
  528.                 ^notice $0 There are $trivia.MAXROUND rounds every game, followed by a wagering round where you can potentially double your score. Points are allocated as $trivia.P.1, $trivia.P.2, $trivia.P.3, and $trivia.P.4 respectively for the $trivia.MAXROUND rounds. Approximately 2 questions per game are daily double questions that carry greater award. To answer, simply type the answer in the channel.
  529.             }
  530.         
  531.             if (word(1 $1-) == [start_game]) {
  532.                 ^notice $0 You can start a game of trivia at any time by typing !trivia start into the trivia channel, but please note that only an admin can stop the game while it is in progress.
  533.             }
  534.  
  535. # Special features help system
  536.  
  537.             if (word(1 $1-) == [daily_double]) {
  538.                 ^notice $0 Every game, there are approximately 2 questions that will have "daily double" after them. Getting those correct will give you double the normal points, but getting them incorrect will cause you to lose half of what the round is worth. If the round is normally worth 2 points, you could potentially gain 4 points or lose 2 points per guess.
  539.             }
  540.  
  541. # Stat commands help system
  542.  
  543.             if (word(1 $1-) == [title]) {
  544.                 ^notice $0 By typing /msg $N !title <title> after you reach a rank of at least $trivia.MAXRANK, you will be able to create a customized title for your personal stat database display.
  545.             }
  546.  
  547.             if (word(1 $1-) == [title_kill]) {
  548.                 ^notice $0 By typing /msg $N !title_kill you can delete your customized title.
  549.             }
  550.  
  551.     # Admin control help system
  552.             if (word(1 $1-) == [add]) {
  553.                 ^notice $0 By typing /msg $N !add <adm_pass> <nick> <pts> you can add points to a specified player.
  554.             }
  555.  
  556.             if (word(1 $1-) == [reset]) {
  557.                 ^notice $0 By typing /msg $N !reset <adm_pass> you can reset the used question list.
  558.             }
  559.  
  560.             if (word(1 $1-) == [save]){
  561.                 ^notice $0 By typing /msg $N !save <adm_pass> you can save trivia variables to the file. Please note that this is currently buggy and may cause unexpected crashes.
  562.             }
  563.  
  564.             if (word(1 $1-) == [start]) {
  565.                 ^notice $0 By typing !start in the channel you can start a game of trivia if it is stopped.
  566.             }
  567.  
  568.             if (word(1 $1-) == [stop]) {
  569.                 ^notice $0 By typing /msg $N !stop <adm_pass> you can stop a game of trivia.
  570.             }
  571.  
  572.             if (word(1 $1-) == [sub]) {
  573.                 ^notice $0 By typing /msg $N !sub <adm_pass> <nick> <pts> you can subtract points from a specified player.
  574.             }
  575.  
  576.             if (word(1 $1-) == [wipe]) {
  577.                 ^notice $0 By typing /msg $N !wipe <adm_pass> <nick> where nick is a case sensitive nickname, you can wipe the personal stat database of the specified player.
  578.             }
  579.         }
  580.         {
  581.             # is this a valid answer
  582.             $compare($0 $1-)
  583.         }
  584.     }
  585. }
  586.  
  587. #     Changes the title of an individual player. This function is assumed only accessible after a
  588. #     player achieves the minimum rank of trivia.MAXRANK.
  589.  
  590. alias change_title {
  591.     ^assign trivia[SELF_TITLE][$encode($0)] $1-
  592.     ^notice $0 Your title has been successfully changed.
  593. }
  594.  
  595. #     Handles the parsing of admin commands. This function assumes that when it is being called, the
  596. #     admin password has already been verified.
  597.  
  598. alias parse_admin {
  599.     if (word(0 $1-) == [!stop]) {
  600.         /endtrivia
  601.     }
  602.  
  603.     if (word(0 $1-) == [!reset]) {
  604.         ^timer 1 /reset_used $0
  605.     }
  606.  
  607.     if (word(0 $1-) == [!wipe]) {
  608.         if (!word(2 $1-)) {
  609.             ^notice $0 [ERROR] Command is !wipe <admin password> <nick>.
  610.         }
  611.         {
  612.             ^timer 1 /wipe_stat $0 $word(2 $1-)
  613.         }
  614.     }
  615.  
  616.     if (word(0 $1-) == [!save]) {
  617.         /sve
  618.         ^notice $0 The current game stats have been saved.
  619.     }
  620.  
  621.     if (word(0 $1-) == [!add]) {
  622.         if (!word(2 $1-) || !word(3 $1-)) {
  623.             ^notice $0 [ERROR] Command is !add <password> <nick> <amt>.
  624.         }
  625.         {
  626.             ^assign trivia.tempmsg $0
  627.             ^assign trivia.temppts $word(3 $1-)
  628.             ^userhost $word(2 $1-) -cmd ^assign trivia.tempadd $$0
  629.             ^userhost $word(2 $1-) -cmd if ([$3]){
  630.                 ^timer 1 /add_score $trivia.tempmsg $trivia.tempadd $trivia.temppts
  631.             }
  632.             {
  633.                 ^notice $trivia.tempmsg [ERROR] Player does not exist on the IRC server.
  634.             }
  635.         }
  636.     }
  637.     
  638.     if (word(0 $1-) == [!sub]) {
  639.         if (!word(2 $1-) || !word(3 $1-)) {
  640.             ^notice $0 [ERROR] Command is !sub <password> <nick> <amt>.
  641.         }
  642.         {
  643.             ^assign trivia.tempmsg $0
  644.              ^assign trivia.temppts $word(3 $1-)
  645.             ^userhost $word(2 $1-) -cmd ^assign trivia.tempadd $$0
  646.             ^userhost $word(2 $1-) -cmd if ([$3]){
  647.                 ^timer 1 /sub_score $trivia.tempmsg $trivia.tempadd $trivia.temppts
  648.             }
  649.             {
  650.                 ^notice $trivia.tempmsg [ERROR] Player does not exist on the IRC server.
  651.             }
  652.         }
  653.     }
  654. }
  655.  
  656. #     Completely wipes a player's personal stat database. The first parameter is the person who invoked
  657. #     this function, and the second parameter is the nickname to wipe.
  658.  
  659. alias wipe_stat {
  660.     # Load the stat file if not loaded yet.
  661.     
  662.     if (!trivia.stat_loaded) {
  663.         if (fileexists(${HOME}/TriviaScript/$trivia.SAVEFILE))
  664.         {
  665.             /load -p ${HOME}/TriviaScript/$trivia.SAVEFILE
  666.         }
  667.     }
  668.     
  669.     # Don't let admins wipe stat during a game, or else weird things might happen.
  670.         
  671.     if (trivia.current) {
  672.         ^notice $0 [ERROR] You cannot use the !wipe command when a game is running.
  673.     }
  674.     {
  675.         ^assign -trivia[SCORE][$encode($1)]
  676.         ^notice $0 $1's personal stat database has been successfully wiped.
  677.     }
  678. }
  679.  
  680.  
  681. #     Increase the score of player $1 by $2 points.
  682.  
  683. alias add_score {
  684.     @trivia.temp = [$2]
  685.  
  686.     if (trivia[SCORE][$encode($1)]) {
  687.         @trivia[SCORE][$encode($1)] = trivia[SCORE][$encode($1)] + trivia.temp
  688.     }
  689.     {
  690.         @trivia[SCORE][$encode($1)] = trivia.temp
  691.     }
  692.     
  693.     ^notice $0 $1's score has been successfully changed.
  694. }
  695.  
  696. #     Decrease the score of player $0 by $1 points.
  697.  
  698. alias sub_score {
  699.     @trivia.temp = [$2]
  700.     @trivia[SCORE][$encode($1)] = trivia[SCORE][$encode($1)] - trivia.temp
  701.     
  702.     ^notice $0 $1's score has been successfully changed.
  703.     
  704. }
  705.  
  706. #     Place the wager for the player by assigning it to $trivia[WAGER][$encode($0)].
  707.  
  708. alias putwager {
  709.     @trivia[WAGER][$encode($0)] = [$1]
  710. }
  711.  
  712. #     Because the normal match procedure only matches one word, the match_all procedure is used
  713. #     to match all words.
  714. alias match_all {
  715.     @trivia.counter = 0
  716.     @function_return = 1
  717.  
  718.     # Determine which answer to use
  719.     
  720.        @trivia.temp = trivia[A][$trivia.round][$trivia.pick]
  721.  
  722.     while (trivia.counter < [$#trivia.temp]) {
  723.         # Perform some generic pattern matching with pluaral and non-plural words.
  724.     
  725.         @trivia.tempword = word($trivia.counter $trivia.temp)
  726.  
  727.         if (right(1 $trivia.tempword) == [s] && right(3 $trivia.tempword) != [ies]) {
  728.             @trivia.tempword2 = left(${@trivia.tempword - 1} $trivia.tempword)
  729.            }
  730.         {
  731.             if (right(1 $trivia.tempword) == [y]) {
  732.                 @trivia.tempword2 = left(${@trivia.tempword - 1} $trivia.tempword)##[ies]
  733.             }
  734.                {
  735.                 if (right(3 $trivia.tempword) == [ies]) {
  736.                     @trivia.tempword2 = left(${@trivia.tempword - 3} $trivia.tempword)##[y]
  737.                 }
  738.                 {
  739.                        @trivia.tempword2 = trivia.tempword##[s]
  740.                 }
  741.             }
  742.         }
  743.         
  744.         # Perform some common typo matching between 'e' and 'i', 'l' and 'r', 'k' and 'c', 'j' and 'z', 'h' and 'u', 'o' and 'u'.
  745.         
  746.         @trivia.guessn1 = strip(ei $1-)
  747.         @trivia.guessn2 = strip(lr $1-)
  748.         @trivia.guessn3 = strip(kc $1-)
  749.         @trivia.guessn4 = strip(jz $1-)
  750.         @trivia.guessn5 = strip(hu $1-)
  751.         @trivia.guessn6 = strip(ou $1-)
  752.         
  753.         @trivia.ansn1 = strip(ei $trivia.tempword)
  754.         @trivia.ansn2 = strip(lr $trivia.tempword)
  755.         @trivia.ansn3 = strip(kc $trivia.tempword)
  756.         @trivia.ansn4 = strip(jz $trivia.tempword)
  757.         @trivia.ansn5 = strip(hu $trivia.tempword)
  758.         @trivia.ansn6 = strip(ou $trivia.tempword)
  759.         
  760.         if (![$match($trivia.tempword $1-)] && ![$match($trivia.tempword2 $1-)] && ![$match($trivia.ansn1 $trivia.guessn1)] && ![$match($trivia.ansn2 $trivia.guessn2)] && ![$match($trivia.ansn3 $trivia.guessn3)] && ![$match($trivia.ansn4 $trivia.guessn4)] && ![$match($trivia.ansn5 $trivia.guessn5)] && ![$match($trivia.ansn6 $trivia.guessn6)]) {
  761.             @function_return = 0
  762.         }
  763.         
  764.         @trivia.counter = trivia.counter + 1
  765.     }
  766. }
  767.  
  768. #     Given the question number, this compares the inputted answer with the correct answer
  769. #     using pattern matching. This function also performs score keeping.
  770.  
  771. alias compare {
  772.     @trivia.finalscore = 0
  773.     @trivia.correct = match_all(0 $1-)
  774.  
  775.     # If correct answer and they have not answered already.
  776.  
  777.     if (trivia.correct){
  778.         if (![$match($0 $trivia.curques)]) {
  779.                         
  780.             # Assign person to people who have already answered the current question correctly.
  781.             ^assign trivia.curques $trivia.curques $0
  782.  
  783.             # update scores if this is a normal round
  784.             if (trivia.round <= trivia.MAXROUND)
  785.             {
  786.                 # Initiate a personal score variable. We must encode the text since some of the
  787.                 # characters in a nickname cannot be part of a variable. If the variable already exists
  788.                 # then add the scores on. We also add the encoded text to a global list so we can remove
  789.                 # all the variables in the end.
  790.  
  791.                 ^assign trivia.finalscore $trivia[P][$trivia.round]
  792.                 
  793.                 # If the question is sudden death, increase the score the player receive, include the bonus
  794.                 # points incurred.
  795.                 
  796.                 if (trivia.deathflag) 
  797.                 {
  798.                     @trivia[SCORE][$encode($0)] = trivia[SCORE][$encode($0)] + trivia.AWARDDEATH * trivia.finalscore
  799.                 }
  800.                 {
  801.                     @trivia[SCORE][$encode($0)] = trivia[SCORE][$encode($0)] + trivia.finalscore
  802.                 }
  803.  
  804.                 
  805.                 if (trivia[SCORE][$encode($0)] > 1)
  806.                 {
  807.                     trivsay Check out the big brain on $0 ! New score $trivia[SCORE][$encode($0)] points !
  808.                 }
  809.                 {
  810.                     trivsay Way to go $0 ! Welcome to the game. You now have $trivia[SCORE][$encode($0)] point !
  811.                 }
  812.                 
  813.                 new_question
  814.             }
  815.         }
  816.         {
  817.             # If they answered the question already
  818.  
  819.             ^notice $0 [ERROR] You have already answered this trivia question!
  820.         }
  821.     }
  822. }
  823.  
  824.  
  825. #     Stops the current trivia challenge round and begin a new one after specified break time.
  826.  
  827. alias question_timed_out {
  828.     trivsay === Round $trivia.round Question $trivia.quesnum Time Limit Expired ===
  829.     trivsay The answer was4 $toupper($trivia[A][$trivia.round][$trivia.pick]).
  830.         
  831.     new_question
  832. }
  833.  
  834. #     begin a new round
  835.  
  836. alias new_question {
  837.  
  838.     ^timer -delete 1
  839.  
  840.     # Decrease the remaining question by one.
  841.  
  842.     @trivia.remaining = trivia.remaining - 1
  843.  
  844.     # If we are in final round and there is no more question, announce the final scores and go into
  845.     # wagering mode. Otherwise set up a timer to show the next question.
  846.  
  847.     ^timer -delete 2
  848.  
  849.     if ((trivia.round == trivia.MAXROUND) && (trivia.remaining == 0)) {
  850.         ^timer -delete 3
  851.         
  852.         ^timer -refnum 3 $trivia.BREAK /score
  853.         ^timer -refnum 2 $trivia.WAGERWAIT /start_wager
  854.         @trivia.active = 0
  855.     }
  856.     {
  857.         
  858.         ^timer -refnum 2 $trivia.BREAK /show_question
  859.     }
  860.  
  861.     @trivia.active = 0
  862. }
  863.  
  864.  
  865.  
  866. #     Start the wagering process by announcing the start of wagering and waiting $trivia.WAGERTIME.
  867.  
  868. alias start_wager {
  869.     @trivia.wager = 1
  870.     @trivia.round = trivia.MAXROUND + 1
  871.     @trivia.remaining = 1
  872.     @trivia.quesnum = 0
  873.     
  874.     trivsay === Wagering Round For $trivia.channel Trivia ===
  875.     trivsay To wager,4 /msg $N !wager <amount> where amount is less than or equal to your total score.
  876.     trivsay You have4 $trivia.WAGERTIME seconds to place your wagers if you choose to participate.
  877.     
  878.     ^timer -refnum 5 $trivia.WAGERTIME /stop_wager
  879. }
  880.  
  881. #     Stops the wagering process by dropping the wager flag and showing the final question.
  882.  
  883. alias stop_wager {
  884.     # Special form of $show_question causing the timer to call $calc_wager() when the timer expires
  885.     # instead of the regular $stop().
  886.     
  887.     @trivia.wager = 0
  888.     @trivia.wager_special = 1
  889.     $show_question(1)
  890. }
  891.  
  892. #     Clear out the used question list.
  893.  
  894. alias reset_used {
  895.     @trivia.usedques = []
  896.     ^notice $0 The used question list has been reset successfully.
  897. }
  898.  
  899.  
  900. #     Terminate the trivia program. ($0 == 1 means normal quit; $0 == 0 means abnormal)
  901.  
  902. alias endtrivia {
  903.     @trivia.winnerscore = 0
  904.  
  905.     if (![$0]) {
  906.         trivsay Trivia terminated at administator request.
  907.         
  908.         foreach trivia.SCORE ii {
  909.             ^assign -trivia[WAGER][$ii]
  910.         }
  911.     }
  912.     {
  913.         # Clear out all player scores according to the global record list. Print out all
  914.         # the scores, and delete the score variables.
  915.         
  916.         trivsay === Final Results For $trivia.channel Trivia ===
  917.         
  918.         foreach trivia.SCORE ii {
  919.             
  920.             # Update the top trivia record if the old one has been broken
  921.             
  922.             if (trivia[SCORE][$ii] > trivia.bestscore) {
  923.                 @trivia.bestscore = trivia[SCORE][$ii]
  924.                 @trivia.bestname = decode($ii)
  925.             }
  926.                         
  927.             # Determine the top score of this game
  928.             
  929.             if (trivia[SCORE][$ii] > trivia.winnerscore) {
  930.                 @trivia.winnerscore = trivia[SCORE][$ii]
  931.             }
  932.         }
  933.         
  934.         score
  935.         
  936.         # clean up
  937.         
  938.         foreach trivia.SCORE ii {            
  939.             ^assign -trivia[WAGER][$ii]
  940.         }
  941.     }
  942.     
  943.     # Clear out all the global variables and timers so weird things don't happen.
  944.     
  945.     if (trivia.active) 
  946.     {
  947.         ^timer -delete 1
  948.     }
  949.     {
  950.         ^timer -delete 2
  951.     }
  952.     
  953.     @trivia.current = 0
  954.  
  955.     trivsay === Type !start to start another round of trivia ===
  956. }
  957.  
  958. #     Calculate the wager results based on what players wagered.
  959.  
  960. alias calc_wager {
  961.     @trivia.active = 0
  962.  
  963.     trivsay === Wagering round is over ===
  964.     trivsay The answer was4 $toupper($trivia[A][$trivia.round][$trivia.pick]).
  965.     
  966.     @trivia.wager_result = []
  967.         
  968.     foreach trivia.SCORE ii {
  969.         
  970.         # If they got the wagering question correct, add the wager. Otherwise, subtract it.
  971.         
  972.         if (trivia[WAGER][$ii]) {
  973.             if (match($decode($ii) $trivia.curques)) {
  974.                 @trivia[SCORE][$ii] = trivia[SCORE][$ii] + trivia[WAGER][$ii]
  975.                 @trivia.wager_result = trivia.wager_result##[4 $decode($ii) won $trivia[WAGER][$ii] points ]
  976.             }
  977.             {
  978.                 @trivia[SCORE][$ii] = trivia[SCORE][$ii] - trivia[WAGER][$ii]
  979.                 @trivia.wager_result = trivia.wager_result##[4 $decode($ii) lost $trivia[WAGER][$ii] points ]
  980.             }
  981.         }
  982.     }
  983.     
  984.     trivsay $trivia.wager_result
  985.     
  986.     $endtrivia(1)
  987. }
  988.  
  989.  
  990. #     Prints out the score of each player whose score is non-zero.
  991.  
  992. alias score {
  993.  
  994.     @trivia.temp = [Current Scores: ]
  995.     
  996.     foreach trivia.SCORE ii {
  997.         if (trivia[SCORE][$ii] == 1 || trivia[SCORE][$ii] == 0) {
  998.             @trivia.temp = trivia.temp##[4 $decode($ii) $trivia[SCORE][$ii] point]
  999.         }
  1000.         {
  1001.             @trivia.temp = trivia.temp##[4 $decode($ii) $trivia[SCORE][$ii] points] 
  1002.         }
  1003.     }
  1004.     trivsay $trivia.temp
  1005. }
  1006.  
  1007.  
  1008. #     Checks to see whether $0 has any points. If so, we move all those points to $1 and delete
  1009. #     the original record. Otherwise, just ignore the event.
  1010.  
  1011. alias update_name {
  1012.  
  1013.     # Process nickname change only if they have score ≠ 0
  1014.     
  1015.     if (trivia[SCORE][$encode($0)]) {
  1016.         # Transfer points over to new nick
  1017.         
  1018.         @trivia[SCORE][$encode($1)] = trivia[SCORE][$encode($0)]
  1019.         
  1020.         # Delete old nick so it's not displayed
  1021.         
  1022.         ^assign -trivia[WAGER][$encode($0)]
  1023.         ^assign -trivia[SCORE][$encode($0)]
  1024.     }
  1025. }
  1026.  
  1027. #     Converts a given amount of questions into an appropriate title
  1028.  
  1029. alias q_to_title {
  1030.     # If they have own title and rank is high enough, use that instead
  1031.     
  1032.     @trivia.tempnet = trivia[SCORE][$encode($1)] 
  1033.     
  1034.     if (trivia[SELF_TITLE][$encode($1)] != [] && trivia.tempnet >= trivia.MAXRANK) {
  1035.         @function_return = [6$trivia[SELF_TITLE][$encode($1)]]
  1036.     }
  1037.     {
  1038.         if ([$0] < 0) { @function_return = [Court Jester] } {
  1039.         if ([$0] < 10) { @function_return = [Lowly Slime Mold] } {
  1040.         if ([$0] < 20) { @function_return = [Growing Slime Mold] } {
  1041.         if ([$0] < 30) { @function_return = [Regular Slime Mold] } {
  1042.         if ([$0] < 40) { @function_return = [Strong Slime Mold] } {
  1043.         if ([$0] < 50) { @function_return = [Slime Mold Master] } {
  1044.         if ([$0] < 60) { @function_return = [Smelly Fungus] } {
  1045.         if ([$0] < 70) { @function_return = [Fresh Fungus] } {
  1046.         if ([$0] < 80) { @function_return = [Kawaii Fungus] } {
  1047.         if ([$0] < 90) { @function_return = [Buffy Fungus] } {
  1048.         if ([$0] < 100) { @function_return = [Fungus Master] } {
  1049.         if ([$0] < 110) { @function_return = [Weak Peon] } {
  1050.         if ([$0] < 120) { @function_return = [Confused Peon] } {
  1051.         if ([$0] < 130) { @function_return = [Ordinary Peon] } {
  1052.         if ([$0] < 140) { @function_return = [Cheerful Peon] } {
  1053.         if ([$0] < 150) { @function_return = [Powerful Peon] } {
  1054.         if ([$0] < 160) { @function_return = [Poor Mercenary] } {
  1055.         if ([$0] < 170) { @function_return = [Lower Class Mercenary] } {
  1056.         if ([$0] < 180) { @function_return = [Middle Class Mercenary] } {
  1057.         if ([$0] < 190) { @function_return = [Upper Class Mercenary] } {
  1058.         if ([$0] < 200) { @function_return = [Mercenary Guildmaster] } {
  1059.             @function_return = q_to_title_2($0)
  1060.         }}}}}}}}}}}}}}}}}}}}}}
  1061. }
  1062.  
  1063. #     Converts a given amount of questions into an appropriate title
  1064.  
  1065. alias q_to_title_2 {
  1066.         if ([$0] < 210) { @function_return = [Apprentice Footman] } {
  1067.         if ([$0] < 220) { @function_return = [Advancing Footman] } {
  1068.         if ([$0] < 230) { @function_return = [Skilled Footman] } {
  1069.         if ([$0] < 240) { @function_return = [Advanced Footman] } {
  1070.         if ([$0] < 250) { @function_return = [Footman Squad Leader] } {
  1071.         if ([$0] < 260) { @function_return = [Unwieldly Thief] } {
  1072.         if ([$0] < 270) { @function_return = [Average Thief] } {
  1073.         if ([$0] < 280) { @function_return = [Skilled Thief] } {
  1074.         if ([$0] < 290) { @function_return = [Very Stealthy Thief] } {
  1075.         if ([$0] < 300) { @function_return = [Master Shadow Thief] } {
  1076.         if ([$0] < 310) { @function_return = [Weak Archer] } {
  1077.         if ([$0] < 320) { @function_return = [Copper Archer] } {
  1078.         if ([$0] < 330) { @function_return = [Silver Archer] } {
  1079.         if ([$0] < 340) { @function_return = [Gold Archer] } {
  1080.         if ([$0] < 350) { @function_return = [Platinum Archer] } {
  1081.         if ([$0] < 360) { @function_return = [Practicing Knight] } {
  1082.         if ([$0] < 370) { @function_return = [Trained Knight] } {
  1083.         if ([$0] < 380) { @function_return = [Skillful Knight] } {
  1084.         if ([$0] < 390) { @function_return = [Silver Knight] } {
  1085.         if ([$0] < 400) { @function_return = [Golden Knight] } {
  1086.             @function_return = [6God of Trivia]
  1087.     }}}}}}}}}}}}}}}}}}}}
  1088. }
  1089.  
  1090.  
  1091. #     Shutdown routine for the bot. This will save the critical variables and then quit IRC.
  1092.  
  1093. alias shutdown {
  1094.     /sve
  1095.     /quit
  1096. }
  1097.  
  1098. alias adminpass {
  1099.     @trivia.ADMINPASS = [$0]
  1100.     echo Your administrator password has been changed
  1101.     sve
  1102. }
  1103.  
  1104. #     Save routine for storing various statistical variables for the trivia script. This
  1105. #     routine has been adapted from the PurePak script. Credit is hereby given.
  1106.  
  1107. alias sve {
  1108.  
  1109.     foreach trivia.SCORE ii {
  1110.         # Update the top trivia record if the old one has been broken
  1111.         
  1112.         if (trivia[SCORE][$ii] > trivia.bestscore) {
  1113.             @trivia.bestscore = trivia[SCORE][$ii]
  1114.             @trivia.bestname = decode($ii)
  1115.         }
  1116.     }
  1117.  
  1118.  
  1119.     @ LF = [${HOME}/TriviaScript/$trivia.SAVEFILE]
  1120.     
  1121.     @ res = delete($LF)
  1122.     
  1123.     @ FHANDLE = open($LF w)
  1124.         
  1125.     if (FHANDLE > 0)
  1126.     {
  1127.         @res = write( $FHANDLE # Trivia version $trivia.VERSION saved settings file )
  1128.         @res = write( $FHANDLE # Written $stime($time()) )
  1129.         @res = write( $FHANDLE # )
  1130.         
  1131.         @res = write( $FHANDLE @ trivia[ADMINPASS] = [$trivia[ADMINPASS]] )
  1132.  
  1133.         @res = write( $FHANDLE # Flag to indicate loading of stat file )
  1134.         @res = write( $FHANDLE @ trivia[stat_loaded] = [1])
  1135.  
  1136.         @res = write( $FHANDLE # Random seeding value )
  1137.         @res = write( $FHANDLE @ trivia[randomvar] = [$trivia[randomvar]] )
  1138.  
  1139.         @res = write( $FHANDLE # Top trivia score holder )
  1140.         @res = write( $FHANDLE @ trivia[bestname] = [$trivia[bestname]] )
  1141.         @res = write( $FHANDLE @ trivia[bestscore] = [$trivia[bestscore]] )
  1142.                 
  1143.         @res = write( $FHANDLE # Number of points the player has )
  1144.         foreach trivia.SCORE ii { @res = write( $FHANDLE @trivia.SCORE.$ii = [$trivia.SCORE[$ii]] )}
  1145.         
  1146.         @res = write( $FHANDLE # Customized titles for players )
  1147.         foreach trivia.SELF_TITLE ii { @res = write( $FHANDLE @trivia.SELF_TITLE.$ii = [$trivia.SELF_TITLE[$ii]] )}
  1148.  
  1149.         @res = write( $FHANDLE echo *** Saved settings loaded from $LF )
  1150.  
  1151.         @res = close( $FHANDLE )
  1152.         
  1153.         echo *** Current settings saved to $LF
  1154.     }
  1155.     {
  1156.         echo *** Could not open $LF !
  1157.     }
  1158.     ^assign -res
  1159.     ^assign -FHANDLE
  1160. }
  1161.  
  1162.  
  1163. #     Help system which private notices a help menu to people who type !help in the channel.
  1164.  
  1165. on -public "* * !help" {
  1166.     ^notice $0 Please type 4/msg $N !help <topic> to receive help on specific topics:
  1167.     ^notice $0 01. General info: copyright, general, start_game
  1168.     ^notice $0 02. Special features: daily_double
  1169.     ^notice $0 03. Stat related: title, title_kill
  1170.     ^notice $0 04. Admin control: add, reset, save, start, stop, sub, wipe
  1171. }
  1172.  
  1173. # General information help system
  1174.  
  1175.  
  1176.  
  1177. #     Respond to trivia answers sent as a regular message. Calls $check_active() to see whether
  1178. #     a question is currently being shown. $check_active() will also filter out commands and
  1179. #     execute them.
  1180.  
  1181. on -public "* *" {
  1182. # in a public handler $0 is the sender, $1 is the channel $2- is the message
  1183.     $handle_public($0 $2-)
  1184. }
  1185.  
  1186. # respond to private messages
  1187. on -msg "* *" {
  1188. # in a private handler $0 is the sender, $1- is the message
  1189.     $handle_private($0 $1-)
  1190. }
  1191.  
  1192. #     Hook to detect changes in nickname so we can update the score database so the points
  1193. #     will move with the person.
  1194. on -channel_nick "* * *" {
  1195.     ^timer 1 /update_name $1 $2
  1196. }
  1197.  
  1198.  
  1199. # this call will start up the script
  1200. trivia
  1201.  
  1202.